<template>
	<view class="order_detaill">
        <view class="order_detaill_cinema">{{ Order.cinemaName }}</view>
        <view class="order_detaill_movie">
            <view class="order_detaill_movie_body">
                <view>
                    <view class="name">{{ Order.movieName }}</view>
                    <view>{{ Order.edition }} {{ Order.quantity }}</view>
                </view>
                <view class="image" :style="`background-image:url(${Order.movieLogo})`"></view>
            </view>
            <view class="order_poi">
                <view><text>{{ Order.playTimeText }}</text>{{ Order.roomName }}</view>
                <view>{{Order.seatName}}</view>
            </view>
            <view class="order_line">
                <view class="line"></view>
                <view class="after"></view>
                <view class="before"></view>
            </view>
            <view class="order_qrcode">
                <text>电影取票码</text>
                <template v-if="Order.qryCode || Order.ticketCode">
                    <image
                        :src="Order.qryCode"
                        mode="widthFix"
                    />
                    <view class="code_box">
                        {{ Order.ticketCode }}
                    </view>
                </template>
                <template v-else>
                    {{Order.orderStatusText?Order.orderStatusText:'出票中...'}}
                </template>
            </view>
        </view>
        <view class="order_desc">
            <text class="title">订单详情</text>
            <view style="display: flex;">
                订单状态：{{ Order.payStatusText }}
            </view>
            <view>手机号码：{{ Order.mobile }}</view>
            <view>订单金额：￥{{ Order.orderAmount }}</view>
            <view>实付金额：￥{{ Order.amount }}</view>
            <view style="display: flex;">订单号码：{{ Order.tradeno }} <uv-tags text="复制" plain size="mini" type="warning" @click="copyOrder" style="margin-left: 32rpx;"></uv-tags></view>
            <view>下单时间：{{ Order.addTime }}</view>
            <view>支付时间：{{ Order.paymenTime }}</view>
        </view>
        <view class="submitBt bg-line-color" v-if="Order.canPay" @click="toPay">去支付</view>
	</view>
</template>

<script setup lang="ts">
import { ref , getCurrentInstance } from 'vue'
import { onLoad } from "@dcloudio/uni-app"
import { getMovieOrderDetail } from "@/api/movie"
const Order = ref<any>({})
const copyOrder = () => {
    uni.setClipboardData({
        data:Order.value.tradeno,//要被复制的内容
        success:()=>{//复制成功的回调函数
          uni.showToast({//提示
            title:'复制成功'
          })
        }
    })
}
const toPay = () => {
    uni.setStorageSync('Movie',{
        logo:Order.value.movieLogo,
        name:Order.value.movieName
    })
    uni.navigateTo({
       url:`/pages/movie/movieOrderConfirm?tradeno=${Order.value.tradeno}`
    })
}
onLoad(async (options : any) => {
    const { proxy } = getCurrentInstance();
	await proxy.$onLaunched;
    getMovieOrderDetail({tradeno : options.tradeno}).then(res => {
        Order.value = res.data
    })
})
</script>

<style lang="scss">
page{
    background:#f5f5f5 !important;
}
.order_detaill{
    padding:32upx;
    .order_detaill_cinema{
        background:#000;
        padding: 32upx 32upx 41upx;
        color:#fff;
        border-top-left-radius: 9px;
        border-top-right-radius: 9px;
    }
    .order_detaill_movie{
        position: relative;
        margin-top:-9px;
        background:#fff;
        padding:32upx;
        border-radius:9px;
        z-index: 1;
        .order_detaill_movie_body{
            display:flex;
            align-items: center;
            justify-content: space-between;
            .image{
                width:17vw;
                height:23vw;
                background-position:center;
                background-size:cover;
                background-repeat: no-repeat;
                margin-left:32upx;
                border-radius:3px;
            }
            .name{
                font-size:36upx;
                color:#000;
                font-weight: 600;
                margin-bottom: 6upx;
            }
        }
        .order_poi{padding-top:32rpx;line-height: 1.5;text{margin-right:32upx;}}
        .order_line{
            position: relative;
            padding:32upx;
            margin-top: 32rpx;
            .line{
                border-top: 7px dotted #f5f5f5;
                height: 1px;
            }
            .after,.before{
                width: 22px;
                height: 22px;
                border-radius: 22px;
                background: #f5f5f5;
                right: -27px;
                top: 16rpx;
                position: absolute;
            }
            .after{right:auto;left:-27px;}
        }
        .order_qrcode{
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            padding:32upx;
            image{
                width:50vw;
                margin:32upx 0;
            }
            text{
                font-weight: 600;
            }
            .code_box{
                padding:32upx;
                border:1px solid #f5f5f5;
                border-radius: 5px;
                text-align: center;
                width: 100%;
                box-sizing: border-box;
            }
        }
    }
    .order_desc{
        padding:32upx;
        margin-top:32upx;
        background:#fff;
        border-radius: 9px;
        display: flex;
        flex-direction: column;
        line-height: 1.5;
        .title{
            font-weight: 600;
            margin-bottom: 12rpx;
        }
        .uv-tags{margin-left:32rpx;}
    }
}
.submitBt{
	position: fixed;
	bottom: 5%;
	width: 92%;
	left: 4%;
	height: 82rpx;
	text-align: center;
	line-height: 82rpx;
	border-radius: 42px;
	font-size: 32rpx;
	font-weight: 600;
	background: linear-gradient(90deg, #F20100 0%, #FD4E16 100%);
	color: #fff;
    z-index: 9;
}
</style>
